In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import geopandas as gpd
import tilemapbase
tilemapbase.start_logging()
In [2]:
features = [
{ "properties" : {"name" : "My office"},
"geometry" : { "type": "Point", "coordinates" : (-1.554934, 53.804198)}
},
{ "properties" : {"name" : "Library"},
"geometry" : { "type": "Point", "coordinates" : (-1.554664, 53.806221)}
},
{ "properties" : {"name" : "Gym"},
"geometry" : { "type": "Point", "coordinates" : (-1.553366, 53.804251)}
}
]
frame = gpd.GeoDataFrame.from_features(features)
In [3]:
frame.crs = {"init": "EPSG:4326"}
frame = frame.to_crs({"init": "EPSG:3857"})
frame
Out[3]:
In [4]:
extent = tilemapbase.extent_from_frame(frame, buffer = 25)
In [5]:
fig, ax = plt.subplots(figsize=(10,10))
plotter = tilemapbase.Plotter(extent, tilemapbase.tiles.OSM, width=400)
plotter.plot(ax)
frame.plot(ax=ax, column="name")
ax.legend(frame.name)
None
In [ ]: